$(function() {

	//二级菜单
	$(".menu-div li").hover(function() {
		// $(this).find(".li-menu-box").show();
		$(this).find(".li-menu-box").stop(true).animate({"height":"320px"});
		$(this).addClass("active");
	}, function() {
		// $(this).find(".li-menu-box").hide();
		$(this).find(".li-menu-box").stop(true).animate({"height":"0"});

		var location = $(this).attr("data-location");
		//表示当前的url和对应的头部链接不一致的情况，清楚active的class
		if(location && window.location.pathname.indexOf(location) == -1){
		  $(this).removeClass("active");
		}
		if(window.location.pathname == "/" && location == "index"){
           $(this).addClass("active");
		}
	});


	$.each($(".menu-div li"), function(index, ele) {
		var location = $(ele).attr("data-location");
         
		if (location && window.location.pathname.indexOf(location) > -1) {
			$(ele).siblings().removeClass("active");
			$(ele).addClass("active");
		}
	})
});
